const store = {
  state: {
    num: 20,
  },
  action: {
    addNum(state, action) {
      state.num++;
    },
    addNum1(state, action) {
      state.num += action.value;
    },
  },
};
/**
 * 下面的将会是固定写法
 */
let reducer = (
  state = {
    ...store.state,
  },
  action
) => {
  let newState = JSON.parse(JSON.stringify(state));
  if (store.action[action.type]) {
    store.action[action.type](newState, action);
  }
  return newState;
};
export default reducer;
